<toolbar id="toolbar"></toolbar>
<!-- 表格 -->
<table id="table" data-toggle="gridview" class="table table-hover" data-url="__URL__" data-toolbar="#toolbar" data-edit="true">
    <thead>
		<tr>
			<th data-width="40" data-align="center" data-checkbox="true"></th>
			<th data-width="200" data-field="name">角色名称</th>
			<th data-width="100" data-field="status" data-formatter="fomat_status">状态</th>
			<th data-width="200" data-field="remark">备注</th>
		</tr>
	</thead>
</table>

<script type="text/javascript">
//格式化数据
function fomat_status(status, row, index){
	if(status == 1){
		return '启用';
	}else if(status == 0){
		return '禁用';
	}
}

$(function(){
	$('#table').on('access_menu', function(e, gridview, params){
		if(gridview.currentRow == null){
			alertMsg('请先选择要授权的角色');
			return false;
		}

		params.data.id = gridview.currentRow.id;
	}).on('access_store', function(e, gridview, params){
		if(gridview.currentRow == null){
			alertMsg('请先选择要授权的角色');
			return false;
		}
		params.data.role_id = gridview.currentRow.id;
	}).on('delete', function(e, gridview, params){
		params.title = '风险提示';
		params.message = '<h5>已使用的角色建议您禁用掉！</h5>' + params.message;
	});
	
	win.getScript('//cdn.bootcss.com/jstree/3.3.1/jstree.min.js');
	win.getStyle('//cdn.bootcss.com/jstree/3.3.1/themes/default/style.min.css');
});
</script>
